<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    mc:Ignorable="d"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="HeadCounterStyles.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="ButtonFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle Margin="2" Stroke="#60000000" StrokeDashArray="1 2" StrokeThickness="1"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="ModernWindowStyle" TargetType="{x:Type Window}">
        <Border Margin="10" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
          <Border.Effect>
            <DropShadowEffect/>
          </Border.Effect>
          <Grid>
            <AdornerDecorator>
              <ContentPresenter/>
            </AdornerDecorator>
            <ResizeGrip
              x:Name="WindowResizeGrip"
              HorizontalAlignment="Right"
              VerticalAlignment="Bottom"
              IsTabStop="false"
              Style="{DynamicResource ResizeGripStyle}"
              Visibility="Collapsed"/>
          </Grid>
        </Border>
        <ControlTemplate.Triggers>
          <MultiTrigger>
            <MultiTrigger.Conditions>
              <Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
              <Condition Property="WindowState" Value="Normal"/>
            </MultiTrigger.Conditions>
            <Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible"/>
          </MultiTrigger>
        </ControlTemplate.Triggers>
  </ControlTemplate>

    <Style x:Key="StatusMessageStyle" TargetType="TextBlock">
        <Setter Property="Foreground" Value="PaleVioletRed" />
    </Style>

    <SolidColorBrush x:Key="ResizeGripperForeground" Color="#888"/>
    
    <Style x:Key="ResizeGripStyle" TargetType="{x:Type ResizeGrip}">
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
        <Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type ResizeGrip}">
              <Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                <Path HorizontalAlignment="Right" Margin="0,0,2,2" VerticalAlignment="Bottom" 
                      Data="M 8,0 L 10,0 L 10,2 L 8,2 Z M 4,4 L 6,4 L 6,6 L 4,6 Z M 8,4 L 10,4 L 10,6 L 8,6 Z M 0,8 L 2,8 L 2,10 L 0,10 Z M 4,8 L 6,8 L 6,10 L 4,10 Z M 8,8 L 10,8 L 10,10 L 8,10 Z" 
                      Fill="White"/>
                <Path HorizontalAlignment="Right" Margin="0,0,5,5" VerticalAlignment="Bottom" 
                      Data="M 8,0 L 10,0 L 10,2 L 8,2 Z M 4,4 L 6,4 L 6,6 L 4,6 Z M 8,4 L 10,4 L 10,6 L 8,6 Z M 0,8 L 2,8 L 2,10 L 0,10 Z M 4,8 L 6,8 L 6,10 L 4,10 Z M 8,8 L 10,8 L 10,10 L 8,10 Z" 
                      Fill="{StaticResource ResizeGripperForeground}"/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="MainTabControl" TargetType="TabControl">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Margin" Value="6,0"/>
        <Setter Property="Padding" Value="4"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Background" Value="{StaticResource DefaultBackground}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="TabControl">
              <Grid ClipToBounds="true" KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="true">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto"/>
                  <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <StackPanel Height="30" Grid.Row="1" HorizontalAlignment="Left" Margin="10,0,10,10" VerticalAlignment="Top" Background="{TemplateBinding Background}">
                  <TabPanel x:Name="HeaderPanel" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" 
                            IsItemsHost="true" KeyboardNavigation.TabIndex="1"/>
                </StackPanel>
                <Grid Grid.Row="1" Margin="0,40,0,0">
                  <ContentPresenter x:Name="PART_SelectedContentHost" Margin="20" ContentSource="SelectedContent"/>
                </Grid>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="MainTabControlItem" TargetType="{x:Type TabItem}">
        <Setter Property="FontFamily" Value="Corbel"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid x:Name="TabItemRoot" Margin="0">
                        <ContentPresenter x:Name="Content" Margin="7,5,7,5" ContentSource="Header" RecognizesAccessKey="True"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{StaticResource ForegroundSelected}"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="false">
                            <Setter TargetName="Content" Property="TextElement.Foreground" Value="{StaticResource ForegroundUnselected}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="SubTabControl" BasedOn="{StaticResource MainTabControl}" TargetType="TabControl">
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="TabControl">
              <Grid ClipToBounds="False" KeyboardNavigation.TabNavigation="Local" SnapsToDevicePixels="true">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto"/>
                  <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="1" HorizontalAlignment="Left" Margin="-10,-42,10,10" VerticalAlignment="Top" Background="{TemplateBinding Background}">
                  <TabPanel x:Name="HeaderPanel" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" IsItemsHost="true" KeyboardNavigation.TabIndex="1"/>
                </StackPanel>
                <Grid Grid.Row="1">
                  <ContentPresenter x:Name="PART_SelectedContentHost" Margin="0,8,0,8" ContentSource="SelectedContent"/>
                </Grid>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="SubTabControlItem" BasedOn="{StaticResource MainTabControlItem}" TargetType="{x:Type TabItem}">
        <Setter Property="FontFamily" Value="Corbel"/>
        <Setter Property="FontSize" Value="28"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type TabItem}">
              <Grid x:Name="TabItemRoot" Margin="0">
                <ContentPresenter x:Name="Content" Margin="6,0,6,6" ContentSource="Header" RecognizesAccessKey="True" />
              </Grid>
              <ControlTemplate.Triggers>
                <Trigger Property="IsSelected" Value="true">
                  <Setter TargetName="Content" Property="TextElement.Foreground" Value="{StaticResource ForegroundSelected}"/>
                </Trigger>
                <Trigger Property="IsSelected" Value="false">
                  <Setter TargetName="Content" Property="TextElement.Foreground" Value="{StaticResource ForegroundUnselected}"/>
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="GlyphPenStyle" TargetType="Path">
        <Setter Property="Stretch" Value="Fill"/>
        <Setter Property="StrokeThickness" Value="1"/>
        <Setter Property="StrokeLineJoin" Value="Round"/>
    </Style>

    <Style x:Key="GlyphPenThickStyle" BasedOn="{StaticResource GlyphPenStyle}" TargetType="Path">
        <Setter Property="StrokeThickness" Value="2"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="StrokeEndLineCap" Value="Square"/>
    </Style>

    <Style x:Key="GlyphButtonStyle" BasedOn="{StaticResource GlyphPenThickStyle}" TargetType="Path">
        <Setter Property="Width" Value="10"/>
        <Setter Property="Height" Value="10"/>
        <Setter Property="Margin" Value="3"/>
        <Setter Property="Stroke" Value="{StaticResource ForegroundUnselected}"/>
    </Style>

    <Style x:Key="GlyphButton" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundUnselected}"/>
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
              <Border x:Name="Border" Background="Transparent" BorderThickness="0">
                <ContentPresenter Name="ContentPresenter" RecognizesAccessKey="True"/>
              </Border>
              <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="true">
                  <Setter TargetName="Border" Property="Background" Value="#D5D5D5"/>
                </Trigger>
                <Trigger Property="IsPressed" Value="true">
                  <Setter TargetName="Border" Property="Background" Value="#E5E5E5"/>
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
  </Style>

    <Style x:Key="LargeInstructionText" TargetType="TextBlock">
        <Setter Property="FontFamily" Value="Calibri"/>
        <Setter Property="FontSize" Value="32"/>
        <Setter Property="Foreground" Value="{StaticResource LightForeground}"/>
        <Setter Property="Opacity" Value="75"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
    </Style>

    <Style x:Key="ShadowStyle">
        <Setter Property="Control.Foreground" Value="LightGray" />
    </Style>
    
    <Style x:Key="ToolbarButtonStyle" TargetType="Button">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Margin" Value="3" />
        <Setter Property="Opacity" Value=".75" />
        <Setter Property="Foreground" Value="{StaticResource ButtonUnselected}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Name="content" SnapsToDevicePixels="True" Typography.Capitals="AllSmallCaps"
                                          TextElement.FontFamily="Corbel" TextElement.FontSize="14"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="content" Property="RenderTransform" >
                                <Setter.Value>
                                    <TranslateTransform Y="1.0" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{StaticResource ButtonDisabled}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Foreground" Value="{StaticResource ButtonSelected}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style x:Key="ToolbarSeparator" TargetType="Border">
        <Setter Property="Margin" Value="3,0" />
        <Setter Property="Height" Value="14" />
        <Setter Property="BorderBrush" Value="DarkGray" />
        <Setter Property="BorderThickness" Value="0,0,1,0" />
    </Style>
</ResourceDictionary>